import http from "@/api";
import { MenuItemType, PutUserStateParam, UserListParam, UserListReturnType ,ChangeMemberMenuParams} from "@Tea/model";

const memberManageHttp = {
  // 获取职位列表
  memberPageList: (params: UserListParam) => http<UserListReturnType[]>({
    method: "post",
    url: "/admin/personnelManage/memberManage/memberList/memberPageList",
    params
  }),
  /**
   * @use 权限降级
   * @param userId 
   * @returns 
   */
  downgradeAuthority: (userId: number) => http({
    method: "put",
    url: "/admin/personnelManage/downgradeAuthority?userId=" + userId,
  }),
  // 通过 userId 获取菜单
  getUserMenuIdById: (userId: UserListReturnType["userId"]) => http<Array<MenuItemType["menuId"]>>({
    method: "get",
    url: `/admin/personnelManage/memberManage/memberList/menuIds?userId=${userId}`
  }),
  // 修改成员菜单
  chagneMemberMenu: (params:ChangeMemberMenuParams) => http({
    method: "put",
    url: "/admin/personnelManage/memberManage/memberList/chagneMemberMenu",
    params
  })
}

export default memberManageHttp